<html>
<head>
<meta charset="utf-8" >
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<title>个人中心</title>
<script type="text/javascript" src="<?php echo $image_url;?>files/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="<?php echo $image_url;?>files/js/fastclick.js"></script>
<script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js" ></script>
<script type="text/javascript" src="<?php echo $image_url;?>files/js/vue.min.js" ></script>
<script type="text/javascript" src="<?php echo $image_url;?>files/js/vue-resource.min.js" ></script>
    <script type="text/javascript" src="<?php echo $image_url;?>files/layer/layer.js"></script>

<link rel="stylesheet" type="text/css" href="<?php echo $image_url;?>files/css/bull_vue-1.0.0.css">
<link rel="stylesheet" type="text/css" href="<?php echo $image_url;?>files/css/bullalert.css">
<link rel="stylesheet" type="text/css" href="<?php echo $image_url;?>files/css/bullshop.css">
<link rel="stylesheet" type="text/css" href="<?php echo $image_url;?>files/d_<?php echo $dealer_num;?>/css/common/alert.css">
<style>
.master {
    position:fixed; z-index:98; top:0px; left:0px; width:100%; height:100%; background-color:rgba(0, 0, 0, 0.5);
}
.mycode{
    width: 90vw; height: 280px; position: fixed; top: 50%; left: 50%; margin-top: -140px; margin-left: -45vw;
    z-index: 99; background: #fff; border-radius: 3px;
}
.myclose{
    font-size:30px; color:#ccc; height:25px; line-height:25px;float:right; padding:0vh 2vw;
}
.codetitle{
    width:90vw;float:left; height:35px; line-height:35px; font-size:18px;color:#333;text-align:center; margin-top:0vh;
}
.codetxt{
    width:70vw; float:left; height:46px; line-height:46px; text-align:center;border:none;
	border:#ccc solid 1px; margin-left:10vw; margin-top:40px; font-size:18px;
}
.codebtn{
    background-color: #2ec4fc;width:70vw;margin-left:10vw; margin-top:40px;height:46px; line-height:46px;text-align:center;border:none;
	border-radius:1vw; color:#fff; font-size:18px;
}

</style>
<script type="text/javascript">

	$(function() {  
		FastClick.attach(document.body);  
	});

	var newNum = "";
	var per = window.innerWidth / 530;
	var globalData = {
		"card": "<?php echo $card;?>",
		"baseUrl": "<?php echo $base_url;?>",
		"openId": "",
        "dealerNum": "<?php echo $dealer_num;?>",
	};
    var userData = {
        "accountId": "<?php echo $user['account_id'];?>",
        "nickname": "<?php echo $user['nickname'];?>",
        "avatar": "<?php echo $user['headimgurl'];?>",
        "card": "<?php echo $card;?>",
        "isManageOn": <?php echo $user['is_manage_on'];?>,
        "userCode":"<?php echo $user['user_code'];?>",
        "isAuthPhone":"<?php echo $isAuthPhone;?>",
        "authCardCount":"<?php echo $authCardCount;?>",
        "phone":"<?php echo $phone;?>",
		"myCode":"<?php echo $my_code==-1||$my_code=='-1'||$my_code==''?20000+$user['user_code']:$my_code;?>",
    };
	var configData = {
		"appId": "<?php echo $config_ary['appId'];?>",
		"timestamp": "<?php echo $config_ary['timestamp'];?>",
		"nonceStr": "<?php echo $config_ary['nonceStr'];?>",
		"signature": "<?php echo $config_ary['signature'];?>",
	};
    var userDataHeight = window.innerWidth * 0.1617 ;
    var myTeamHeight = window.innerWidth *  0.1375 ;
    userDataHeight = window.innerWidth * 0.1617 ;
    myTeamHeight = window.innerWidth *  0.1375 ;
    viewOffsetCount = 1;

    var pageii;
// $(function(){
//     if(userData.phone == ""){
//         clickPhone();
//     }
// });

    function clickPhone() {
        pageii = layer.open({
            title: [
                '账号绑定',
                'background-color:rgb(64,112,251); color:#fff;margin:0'
            ]
            ,btn:"我已记住账号和密码，立即绑定"
            ,yes:function(index){
                $("#message").html("");
                var phone = $("#phone").val();
                //if ( !checkPhone(phone)){
                //    $("#message").html("手机号码格式不正确");
                //    return false;
                //}
                var authcode = $("#smscode").val();
                //if (!checkAuthcode(authcode)) {
                //    $("#message").html("验证码格式不正确");
                //    return false;
                //}
                var password = $("#password").val();
                if (!checkPassword(password) ) {
                    $("#message").html("密码太短");
                    return false;
                }
                var data = {"dealer_num": globalData.dealerNum, "phone":phone, "code":'1111',"password":password};
                console.log(data);
                $.ajax(globalData.baseUrl + 'account/checkSmsCode', {
                    method: 'POST',
                    contentType: 'application/json;charset=utf-8',
                    data: JSON.stringify(data),
                    success:function(response) {
                        var bodyData = $.parseJSON(response);
                        if (bodyData.result == -1) {
                            $("#message").text(bodyData.result_message);
                        }else {
                            //提示
                            layer.open({
                                content: '修改成功'
                                ,skin: 'msg'
                                ,time: 2 //2秒后自动关闭
                            });
                            setTimeout(function () {
                                location.reload();
                            },1000)
                        }
                    }
                });

                return false;
            }
            ,content: $("#validePhone").val()
            ,anim: 'up'
        });
    }
    var JQauthcodeTime = 0;
    var JQauthcodeType = 1;
    function JQgetAuthcode() {
        if (JQauthcodeType == 1) {
            var phone = $("#phone").val()
            var data = {"dealer_num": globalData.dealerNum, "phone": phone};
            $.ajax(globalData.baseUrl + 'account/getMobileSms', {
                method: 'POST',
                contentType: 'application/json;charset=utf-8',
                data: JSON.stringify(data),
                success: function (response) {
                    var bodyData = $.parseJSON(response);
                    console.log(bodyData);
                    if (bodyData.result == 0) {
                        JQauthcodeTime = 60;
                        JQauthcodeTimer();
                    } else {
                        $("#message").text(bodyData.result_message);
                    }

                }
            });
        }
    }
    var JQauthcodeTimer = function JQauthcodeTimer() {
        if (JQauthcodeTime <= 0) {
            $("#authcode").html('发送验证码');
            JQauthcodeTime = 60;
            JQauthcodeType = 1;
            return;
        }

        JQauthcodeTime = JQauthcodeTime - 1;
        $("#authcode").html(JQauthcodeTime + 's');
        JQauthcodeType = 2
        setTimeout(function () {
            JQauthcodeTimer();
        }, 1000);
    };
</script>

<style type="text/css">
	.gameItem{position: absolute;background-color: #291c4d;}
</style>

</head>

<body style="background-color: #0e0226">

	<div id="loading" style="position: fixed;width:100%;height:100%;top:0;left:0;background: #000" >
		<img src="<?php echo $image_url;?>files/images/loading.gif" style="top: 40%;position: absolute;left: 50%;margin-left: -45px;margin-top: -45px;" />
	</div>

	<div class="main" id="app-main" style="position: relative; width: 100%;margin: 0 auto; background: #0e0226; ">

        <!-- 提示框 -->
        <div class="alert" id="valert" v-show="isShowAlert">
            <div class="alertBack"></div>
            <div class="mainPart">
                <div class="backImg">
                    <div class="blackImg"></div>
                </div>
                <div class="alertText">{{alertText}}</div>
                <div v-show="alertType==3">
                    <div class="buttonLeft" v-on:click="closeAlert">确定</div>
                    <div class="buttonRight" v-on:click="closeAlert">取消</div>
                </div>
                <div v-show="alertType==7">
                    <div class="buttonMiddle" v-on:click="closeAlert">确定</div>
                </div>
                <div v-show="alertType==8">
                </div>
                <div v-show="alertType==23">
                    <div class="buttonMiddle" v-on:click="finishBindPhone()">确定</div>
                </div>
                <div v-show="alertType==24">
                    <div class="buttonLeft" v-on:click="finishManageOn()">确定</div>
                    <div class="buttonRight" v-on:click="closeAlert">取消</div>
                </div>
            </div>
        </div>
        <!-- <div class="choujiangbtn" style=" position: absolute; z-index: 99; top: 25vh; right:0 ;"><a href="<?php echo $base_url."jiang/chou" ?>" ><img style=" width: 17vw;" src="<?php echo $image_url;?>files/choujiang/image/8e3.png"></a></div>-->
        <!-- 用户头像 -->
        <div v-bind:style="viewStyle.user">
        	<div v-bind:style="viewStyle.userAvatar">
        		<img v-bind:src="user.avatar" v-bind:style="viewStyle.userAvatarImg">
        	</div>
        	<div v-bind:style="viewStyle.userName">
        		{{user.nickname}}
        	</div>
            <img src="<?php echo $image_url;?>files/images/activity/homepage_phone.png" style="position: absolute;left: 27vw; bottom: 2vw;width: 27vw;height: 8vw;"  onclick="clickPhone()"  v-show="!isPhone">

            <div style="position: absolute;left: 27vw; bottom: 2vw;width: 40vw;height: 7vw;font-size: 2.2vh;color: rgb(64,112,251);" onclick="clickPhone()" v-show="isPhone">
                {{phone}}&nbsp&nbsp修改
            </div>

			<div style="position: absolute;bottom: 2vw;right: 4vw;width: 24vw;height: 18vw;background-color: rgb(13,6,42);border-style: solid;border-color: orange;border-width: 0.1vh;border-radius: 0.5vh;" >
				<div style="position: absolute;top: 1vw;width: 100%;height: 9vw;line-height: 9vw;font-size: 2.5vh;color: white;text-align: center;overflow: hidden;">
					{{roomCard}}张
				</div>
                <div id="receiveroomcard" style="position: absolute;top: 8vw;width: 100%;height: 9vw;line-height: 9vw;font-size: 2.3vh;color: orange;text-align: center;overflow: hidden;">
                    领取房卡
                </div>
			</div>
        </div>

		<!-- 发送红包记录 -->
        <div v-bind:style="viewStyle.sendRedpackage" v-on:click="showSendRedpackage">
            <img src="<?php echo $image_url;?>files/images/activity/rc_icon_sendredpackage.png" v-bind:style="viewStyle.rcIcon">
            <img src="<?php echo $image_url;?>files/images/activity/rc_icon_rightarrow.png" v-bind:style="viewStyle.rcArrow">
            <p v-bind:style="viewStyle.rcContent">发送房卡</p>
        </div>
        <!-- 查看红包记录 -->
        <div v-bind:style="viewStyle.redpackage" v-on:click="showRedpackageRecord">
        	<img src="<?php echo $image_url;?>files/images/activity/rc_icon_redpackage.png" v-bind:style="viewStyle.rcIcon">
        	<img src="<?php echo $image_url;?>files/images/activity/rc_icon_rightarrow.png" v-bind:style="viewStyle.rcArrow">
        	<p v-bind:style="viewStyle.rcContent">卡包记录</p>
        </div>

        <!-- 查看游戏记录 -->
        <div v-bind:style="viewStyle.myGameRoom"  v-on:click="toGameScore">
            <img src="<?php echo $image_url;?>files/images/activity/rc_icon_redpackage.png" v-bind:style="viewStyle.rcIcon">
            <img src="<?php echo $image_url;?>files/images/activity/rc_icon_rightarrow.png" v-bind:style="viewStyle.rcArrow">
            <p v-bind:style="viewStyle.rcContent">游戏记录<span style="color: orange; font-size: 12pt;">(我参与的)</span></p>
        </div>

        <!-- 开房查询 -->
        <div id="myTeamInfo" v-bind:style="viewStyle.myTeamInfo" v-on:click="showMyRoom">
            <img src="<?php echo $image_url;?>files/images/activity/kfcx.png" v-bind:style="viewStyle.rcIcon">
            <img src="<?php echo $image_url;?>files/images/activity/rc_icon_rightarrow.png" v-bind:style="viewStyle.rcArrow">
            <p v-bind:style="viewStyle.rcContent">开房查询<span style="color: orange; font-size: 12pt;">(我创建的)</span></p>
        </div>
		
		<!-- 设置防伪码 -->
        <div id="myCodeInfo" v-bind:style="viewStyle.myCodeDiv" v-on:click="showMyCode">
            <img src="<?php echo $image_url;?>files/images/activity/mycode.png" v-bind:style="viewStyle.rcIcon">
            <img src="<?php echo $image_url;?>files/images/activity/rc_icon_rightarrow.png" v-bind:style="viewStyle.rcArrow">
            <p v-bind:style="viewStyle.rcContent">设置防伪码</p>
			<p v-bind:style="viewStyle.rcContent2">{{myCode}}</p>
        </div>

        <!-- 管理功能 -->
        <div v-bind:style="viewStyle.manage" >
            <img src="<?php echo $image_url;?>files/images/activity/qzgl.png" v-bind:style="viewStyle.rcIcon">
            <img src="<?php echo $image_url;?>files/images/activity/btn_off.png" v-bind:style="viewStyle.btnOnOff"  v-on:click="openManage" v-show="!userData.isManageOn">
            <img src="<?php echo $image_url;?>files/images/activity/btn_on.png"  v-bind:style="viewStyle.btnOnOff"  v-on:click="closeManage" v-show="userData.isManageOn">
            <p v-bind:style="viewStyle.rcContent">俱乐部管理</p>
        </div>

        <div v-bind:style="viewStyle.manageDiv" v-show="userData.isManageOn">
            <div style="position: absolute;left: 0vw;width: 25vw;height: 25vw;" v-on:click="clickInvite">
                <img src="<?php echo $image_url;?>files/images/activity/homepage_invite.png" style="position: absolute;top: 4vw;left: 7.5vw;width: 10vw;height: 10vw;">
                <div style="position: absolute;top: 6vw;left: 24vw;width: 0.2vw;height: 12vw;background-color: rgb(155,142,224);"></div>
                <div style="position: absolute;bottom: 0;width: 100%;height: 10vw;line-height: 10vw;font-size: 2vh;text-align: center;color: white;">
                    邀请成员
                </div>
            </div>
            <div style="position: absolute;left: 25vw;width: 25vw;height: 25vw;" v-on:click="clickGroupMember">
                <img src="<?php echo $image_url;?>files/images/activity/member_union.png" style="position: absolute;top: 4vw;left: 7.5vw;width: 10vw;height: 10vw;">
                <div style="position: absolute;top: 6vw;left: 23vw;width: 0.2vw;height: 12vw;background-color: rgb(155,142,224);"></div>
                <div style="position: absolute;bottom: 0;width: 100%;height: 10vw;line-height: 10vw;font-size: 2vh;text-align: center;color: white;">
                    俱乐部成员
                </div>
            </div>
            <div style="position: absolute;left: 50vw;width: 25vw;height: 25vw;" v-on:click="window.location.href = globalData.baseUrl + 'f/ss';">
                <img src="<?php echo $image_url;?>files/images/activity/kfcx.png" style="position: absolute;top: 4vw;left: 7.5vw;width: 10vw;height: 10vw;">
                <div style="position: absolute;top: 6vw;left: 23vw;width: 0.2vw;height: 12vw;background-color: rgb(155,142,224);"></div>
                <div style="position: absolute;bottom: 0;width: 100%;height: 10vw;line-height: 10vw;font-size: 2vh;text-align: center;color: white;">
                    战绩统计
                </div>
            </div>
        </div>
		<!-- 绑定手机号码 -->
		<textarea id="validePhone" style="display: none;" >
			<div class="phoneFrame">
				<div style="text-align: left;height: 15vw;word-wrap: break-word;word-break: break-all;color: #000;background-color: white;border-top: solid;border-color: #e6e6e6;border-width: 0px;">
					<input type="text" id="phone" name="phone" placeholder="输入手机号或者账号" style="float: left;padding:0 12px 0 12px;width: 65vw;height: 11vw;line-height: 6.5vw;border-style: solid;border-width: 1px;border-radius: 0.5vh;border-color: #e6e6e6;font-size: 4vw;-webkit-appearance: none;">
					<!--<div id="authcode" onclick="JQgetAuthcode()" style="text-align:center;background-color:rgb(64,112,251);float: left; width: 22vw;height: 11.5vw;line-height: 11.5vw;font-size: 3.5vw;border-radius: 0.5vh;color: white;">
						发送验证码
					</div>-->
				</div>
				<!--<div style="text-align: left;height: 15vw;word-wrap: break-word;word-break: break-all;color: #000;background-color: white;border-top: solid;border-color: #e6e6e6;border-width: 0px;">
					<input type="number" id="smscode" name="smscode" placeholder="输入验证码" style="padding:0 12px 0 12px;left: 4vw;width: 65vw;height: 11vw;line-height: 6.5vw;border-style: solid;border-width: 1px;border-radius: 0.5vh;border-color: #e6e6e6;font-size: 4vw;-webkit-appearance: none;">
				</div>-->
				<div style="text-align: left;height: 15vw;word-wrap: break-word;word-break: break-all;color: #000;background-color: white;border-top: solid;border-color: #e6e6e6;border-width: 0px;">
					<input type="text" id="password" name="password" placeholder="设置登录密码" maxlength="12" style="padding:0 12px 0 12px;left: 4vw;width: 65vw;height: 11vw;line-height: 6.5vw;border-style: solid;border-width: 1px;border-radius: 0.5vh;border-color: #e6e6e6;font-size: 4vw;-webkit-appearance: none;">
				</div>
                <div id="message" style="color: #ff0000; text-align: left;"></div>
			</div>
		</textarea>
		
		<div id="myCode" style="display:none;" v-show="isShowMyCode">
            <div class="master"></div>
            <div class="mycode">
                <div class="myclose" v-on:click="hideMyCode">×</div>
                <div class="codetitle">防伪码设置</div>
                <input type="text" class="codetxt" placeholder="输入1-6个数字,字母或汉字" v-model="sMyCode" name="myCode">
	            <input type="button" class="codebtn" value="确认" v-on:click="saveMyCode()">
            </div>
        </div>

	</div>

</body>

<script type="text/javascript" src="<?php echo $image_url;?>files/js/roomcard/roomcard.js"></script>
<script>
    $("#receiveroomcard").click(function () {
        layer.prompt({title: '请输入房卡包密码，并确认', formType: 0}, function(redCode, index){
            layer.close(index);
            location.href = "<?php echo $base_url?>/ay/rpD?red_code=" + redCode;
        });
    });
</script>
</html>
